﻿using System;
using System.Collections.Generic;

namespace RZ.Collections.Extensions
{
    public static class ListExtension
    {
        public static Int32 FindIndex<T>(this IList<T> list, Int32 startPosition, Func<T, bool> predicate)
        {
            var listCount = list.Count;
            for (var searchIndex = startPosition; searchIndex < listCount; ++searchIndex)
            {
                if (predicate(list[searchIndex]))
                    return searchIndex;
            }
            return -1;
        }
    }
}
